Tweak the click-through handling so active apps get it (but not inactive ones)
authorRichard Hult <richard@imendio.com>
Fri, 20 Feb 2009 14:36:15 +0000 (15:36 +0100)
committerAlexander Larsson <alex@localhost.localdomain>
Thu, 2 Apr 2009 08:16:30 +0000 (10:16 +0200)
gdk/quartz/gdkevents-quartz.c

index 5b93ad51793a02bca402cc49dfaf7d4f2c6de8c4..db73a11c321f4bb954c99e5f252b497f5bbf4743 100644 (file)
@@ -1040,9 +1040,10 @@ gdk_event_translate (GdkEvent *event,
        }
     }
 
-  /* If the app is not active, or the window (when not grabbed) is not
-   * active, leave the event to AppKit so the window gets focused correctly
-   * and don't do click-through (so we behave like most native apps).
+  /* If the app is not active leave the event to AppKit so the window gets
+   * focused correctly and don't do click-through (so we behave like most
+   * native apps). If the app is active, we focus the window and then handle
+   * the event, also to match native apps.
    */
   if ((event_type == NSRightMouseDown ||
        event_type == NSOtherMouseDown ||
@@ -1057,7 +1058,13 @@ gdk_event_translate (GdkEvent *event,
           return FALSE;
         }
       else if (![impl->toplevel isKeyWindow])
-        return FALSE;
+        {
+          GdkPointerGrabInfo *grab;
+
+          grab = _gdk_display_get_last_pointer_grab (_gdk_display);
+          if (!grab)
+            [impl->toplevel makeKeyWindow];
+        }
     }
 
   current_event_mask = get_event_mask_from_ns_event (nsevent);